package com.leyou.service.impl;

import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.leyou.dao.CategoryBrandDao;
import com.leyou.entity.CategoryBrandEntity;
import com.leyou.service.CategoryBrandService;


@Service("categoryBrandService")
public class CategoryBrandServiceImpl extends ServiceImpl<CategoryBrandDao, CategoryBrandEntity> implements CategoryBrandService {

    /**
     * 根据分类id查询
     * @param cid
     * @return
     */
    @Override
    public List<CategoryBrandEntity> getInfoByCategoyId(Long cid) {

        return this.list(new QueryWrapper<CategoryBrandEntity>().eq("category_id", cid));
    }

    /**
     * 根据品牌id删除
     * @param id
     */
    @Override
    public void deleteBybreadId(Long id) {
        this.remove(new QueryWrapper<CategoryBrandEntity>().eq("brand_id",id));
    }

    /**
     * 根据品牌id查询
     * @param bid
     * @return
     */
    @Override
    public List<CategoryBrandEntity> getInfoBybreadId(Long bid) {
      return  this.list(new QueryWrapper<CategoryBrandEntity>().eq("brand_id", bid));
    }
}